#include<iostream>
using namespace std;
class Date {
private:
	int year;
	int month;
	int day;
public:
	Date(int y = 2004, int m = 1, int d = 1) :year(y), month(m), day(d) {

	}
	bool isLeapYear() {
		return year % 400 == 0 || year % 4 == 0 && year % 100 != 0;
	}
	int getDay() {
		int num = 0;
		int p[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
		if (isLeapYear()) {
			p[1]++;
		}
		for (int i = 1; i < month; i++) {
			num += p[i - 1];
		}
		num += day;
		return num;
	}
};
int main()
{
	int n1, n2;
	cin >> n1 >> n2;
	int year1 = n1 / 10000;
	int year2 = n2 / 10000;
	int month1 = (n1 % 10000) / 100;
	int month2 = (n2 % 10000) / 100;
	int day1 = n1 % 100;
	int day2 = n2 % 100;
	int num = 0;
	if (year1 == year2) {
		Date D1(year1, month1, day1);
		Date D2(year2, month2, day2);
		num = D1.getDay() - D2.getDay();
		if (num < 0) {
			num = -num;
		}
	}
	else if (year1 > year2) {
		while (year1 != year2) {
			if (year1 % 400 == 0 || year1 % 4 == 0 && year1 % 100 != 0) {
				num += 366;
			}
			else {
				num += 365;
			}
			year1--;
		}
		Date D1(year1, month1, day1);
		Date D2(year2, month2, day2);
		num += D1.getDay() - D2.getDay();
	}
	else {
		while (year1 != year2) {
			if (year2 % 400 == 0 || year2 % 4 == 0 && year2 % 100 != 0) {
				num += 366;
			}
			else {
				num += 365;
			}
			year2--;
		}
		Date D1(year1, month1, day1);
		Date D2(year2, month2, day2);
		num += D2.getDay() - D1.getDay();
	}
	num++;
	cout << num;
	return 0;
}